package com.xunlai.infra.permission.storage.entity;

import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @author liang
 * @date 2022/11/30 18:39
 */
@Table("system_role")
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Role extends BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = -3311715973525842268L;

    @Id
    private Long id;

    private String roleName;

    private String roleCode;

    private Short type;

    private Short enable;

    @MappedCollection(idColumn = "role_id",keyColumn = "id")
    private List<RoleRelation>  roleRelations;

    @MappedCollection(idColumn = "role_id",keyColumn = "id")
    private List<RolePermission> rolePermissions;

    
}
